package com.msb.bf;

import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author: zhaoyi
 * @create: 2020-05-10 21:44
 * @description:
 **/

public class Test {

    public static void main(String[] args) throws InterruptedException, ExecutionException {

        ReentrantLock lock = new ReentrantLock();

        new Thread(()->{
            //不释放锁看下一个线程操作
            lock.lock();
        }).start();

        //sleep先让上面的线程获取到锁，然后执行完了也不释放锁，下面的将获取不到锁
        Thread.sleep(1000);

        lock.lock();
        System.out.println("============");
        lock.unlock();



    }
}
